package patterns.observer;

/**
 * Created by lenovo on 2016/12/1 0001.
 * 使用subject和实体类观察者
 */
public class ObserverPatternDemo {
    public static void main(String[] args){
        Subject subject = new Subject();

        new HexaObserver(subject);
        new OctalObserver(subject);
        new BinaryObserver(subject);

        System.out.println("第一次状态改变：state = 15");
        subject.setState(15);
        System.out.println("第二次状态改变：state = 20");
        subject.setState(20);
    }
}
